package com.itheima.chapter08.set.TreeSet;

import java.util.Set;
import java.util.TreeSet;

public class Treesetdemo2 {
    public static void main(String[] args) {
        Set<studentdemo2> set =new TreeSet<>();
        studentdemo2 s1= new studentdemo2("zhangsan",23);
        studentdemo2 s2= new studentdemo2("zhanli",31);
        studentdemo2 s3= new studentdemo2("lilin",26);
        set.add(s1);
        set.add(s2);
        set.add(s3);
        System.out.println(set);//ClassCastException
        //没有给定排序规则，报错
    }
}
